﻿using HackApp.Entities;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace HackApp.Models
{
  public class PostModel
  {
    public int Id { get; set; }

    [Required]
    public string Content { get; set; }
    
    public string Author { get; set; }
    
    public DateTime DateCreated { get; set; }

    public PostDTO ToDTO()
    {
      PostDTO dto = new PostDTO();
      dto.Id = this.Id;
      dto.Content = this.Content;
      dto.Author = this.Author;
      
      return dto;
    }

    public void ToVM(PostDTO dto)
    {
      this.Id = dto.Id;
      this.Content = dto.Content;
      this.Author = dto.Author;
    }
  }
}